import { View, Text, Button } from "@tarojs/components";
import { AtAvatar, AtModal, AtModalHeader, AtModalContent, AtModalAction, } from 'taro-ui';
import { useEffect, useState } from 'react';
import Taro from '@tarojs/taro';
import './index.scss'

const Admin = () => {
  // 定义弹出框的状态
  const [isOpened, SetMaodl] = useState(true)

  //弹出框的关闭，和打开
  const close = () => {
    SetMaodl(false)
  };
  const allow = () => {
    SetMaodl(false)
  };
  const on = () => {
    SetMaodl(true)
  };

  //跳转
  const to = (v) => {
    console.log(v)
    Taro.navigateTo({
      url: v
    })
  }

  return (
    <>
      <View className='heard'>
        <View>
          <View>鲜丰水果</View>
          <View>所属拼团点：社区名称</View>
        </View>
        <View onClick={on}>
          <AtAvatar circle='true' size='large' image='https://jdc.jd.com/img/200' ></AtAvatar>
        </View>
      </View>

      <View className='option'>
        <View onClick={() => { to('/pages/Admin/Shopdata') }}>店铺资料</View>
        <View onClick={() => { to('/pages/Admin/feedbback') }}>反馈建议</View>
        <View onClick={() => { to('/pages/Admin/collage') }}>拼团统计</View>
        <View onClick={() => { to('/pages/Admin/template') }}>模板库</View>
      </View>

      <View className='tips'>
        <View>有任何疑问请联系拼团点团长</View>
        <View>1.0</View>
      </View>

      {/* 模态框 */}
      <AtModal isOpened={isOpened}>
        <AtModalHeader>微信授权</AtModalHeader>
        <AtModalContent>

          <View className='modal'>
            <View>社区拼团商家版申请获得以下权限:</View>
            <View></View>
            <View>
              获得你的公开信息（昵称，头像等）
            </View>
          </View>

        </AtModalContent>
        <AtModalAction> <Button onClick={close}>拒绝</Button> <Button onClick={allow}>允许</Button> </AtModalAction>
      </AtModal>
    </>

  )
};
export default Admin;
